package com.rabbiter.oes.enums;

/**
 * 身份枚举
 */
public enum RoleEnum {
    ADMIN(0, "管理员"),
    TEACHER(1, "教师"),
    STUDENT(2, "学生"),

    UNKNOWN(3, "未知");

    public static RoleEnum getRoleEnum(Integer code) {
        for (RoleEnum roleEnum : RoleEnum.values()) {
            if (roleEnum.code == code) {
                return roleEnum;
            }
        }
        throw new IllegalArgumentException("未获取到身份信息");
    }

    RoleEnum(Integer code, String roleValue) {
        this.code = code;
        this.roleValue = roleValue;
    }

    private final Integer code;

    private final String roleValue;

    public Integer getCode() {
        return code;
    }

    public String getRoleValue() {
        return roleValue;
    }
}
